home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Grab Bag
/
Shareware Grab Bag.iso
/
007
/
cstdio.arc
/
SRC.ARC
/
FTELL.C
< prev
next >
Wrap
C/C++ Source or Header
|
1984-07-28
|
438b
|
21 lines
/* ftell.c - return current position of a stream.
(C) Copyright 1984 Gregory R. Mansfield - All Rights Reserved.
G. R. Mansfield. 84/07/26.
Ver 1.0-4726.
*/
#include <stdio.h>
long ftell(fp) /* return current position of a stream */
FILE *fp;
{
long offset;
offset = lseek(fp->_fd, 0L, 1);
if (fp->_flag & _READ)
offset -= (long)fp->_cnt;
else
offset += (long)(fp->_ptr - fp->_base);
return(offset);
}